<%@ page contentType="text/html;charset=UTF-8"  isELIgnored="false" language="java" %>
<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <meta name="renderer" content="webkit">
    <title></title>
    <link rel="stylesheet" href="../css/pintuer.css">
    <link rel="stylesheet" href="../css/admin.css">
    <script src="../js/jquery.js"></script>
    <script src="../js/pintuer.js"></script>
</head>
<body>
<div class="panel admin-panel">
    <div class="panel-head"><strong><span class="icon-key"></span> 修改教师密码</strong></div>
    <div class="body-content">
        <div  class="form-x">
            <div class="form-group">
                <div class="label">
                    <%--          sitename--%>
                    <label for="admin">教师帐号：</label>
                </div>
                <div class="field" id="admin">
                    <label style="line-height:33px;">
                        ${sessionScope.user.username}
                    </label>
                </div>
            </div>
            <div class="form-group">
                <div class="label">
                    <label for="oldpassword">原始密码：</label>
                </div>
                <div class="field">
                    <input type="password" id="oldpassword" class="input w50" id="mpass" name="mpass" size="50" placeholder="请输入原始密码" data-validate="required:请输入原始密码" />
                </div>
            </div>
            <div class="form-group">
                <div class="label">
                    <label for="newpassword1">新密码：</label>
                </div>
                <div class="field">
                    <input type="password"  id="newpassword1" class="input w50" name="newpass" size="50" placeholder="请输入新密码" data-validate="required:请输入新密码,length#>=5:新密码不能小于5位" />
                </div>
            </div>
            <div class="form-group">
                <div class="label">
                    <label for="newpassword2">确认新密码：</label>
                </div>
                <div class="field">
                    <input type="password" id="newpassword2" class="input w50" name="renewpass" size="50" placeholder="请再次输入新密码" data-validate="required:请再次输入新密码,repeat#newpass:两次输入的密码不一致" />
                </div>
            </div>

            <div class="form-group">
                <div class="label">
                    <label></label>
                </div>
                <%--        <div class="field">--%>
                <%--          <button class="button bg-main icon-check-square-o" id="putup" type="submit"> 提交</button>--%>
                <%--        </div>--%>
                <button style="width: 200px;height: 40px;background-color: #ddeeff" type="button" id="putup" >查询</button>
            </div>
            <script>
                $("#putup").click(function() {
                    var id = ${sessionScope.user.id};
                    var password = ${sessionScope.user.password};
                    var oldpassword = $("#oldpassword").val();
                    var newpassword1 = $("#newpassword1").val();
                    if(password==oldpassword){
                        $.post("/updateUserPwd",{id:id+'',username:"lll",password:newpassword1},function (data) {
                            if (data=="OK"){
                                alert("修改成功！！");
                            }else{
                                alert("修改失败！！！")
                            }
                        },"json");
                    }else{
                        alert("您输入的旧密码错误！！");
                    }
                });
            </script>
        </div>
    </div>
</div>
</body></html>